package com.ruoyi.resume.service.impl;

import com.ruoyi.resume.domain.model.ResumeRawData;
import com.ruoyi.resume.mapper.ResumeRawDataMapper;
import com.ruoyi.resume.service.resumeComparisonService;
import com.ruoyi.resume.utils.deepseek.DeepSeekV3Client;
import com.ruoyi.resume.utils.zhipu.Glm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ResumeComparisonServiceImpl implements resumeComparisonService {
    @Autowired
    private ResumeRawDataMapper resumeRawDataMapper;


    @Override
    public String compare(Integer resumeId1, Integer resumeId2, String requirements) {
        ResumeRawData resumeRawData1 = resumeRawDataMapper.getResumeById(resumeId1);
        ResumeRawData resumeRawData2 = resumeRawDataMapper.getResumeById(resumeId2);
        String prompt = "如果你是面试官或招聘人员，请对比一下两份简历，分别从" +
                "1. 基本信息" +
                "2. 教育经历（按时间倒序排列）" +
                "3. 实习经历（保留具体职责描述）" +
                "4. 工作经历（保留项目细节）" +
                "5. 项目经历（保留技术细节）" +
                "6. 相关技能（保持原始技能描述格式）" +
                "7. 其他信息" +
                "等情况，列出表格进行分析，最后进行总结\n";
        if(requirements!=null&&!requirements.equals("")) {
            prompt = prompt + "侧重点：" + requirements + "\n";
        }
        prompt = prompt + "简历A：" + resumeRawData1.getResumeData() + "\n\n简历2：" + resumeRawData2.getResumeData() + "\n";
        String result = Glm.chatGLM4(prompt);

        return result;
    }
}
